<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 在子类中的super关键字指向的时子类本身
        class Father {
            constructor() {
                this.name = "parent"
            }
            print() {
                console.log(this, '这里的this被子类继承过去了');
                console.log(this.name, );
            }
        }
        class Son extends Father {
            constructor() {
                super();
                this.name = "child"
            };
            print() {
                super.print();
            }
        }
        const s = new Son();
        s.print()
    </script>

    <script>
        // 作为对象使用访问方法
        // 在普通方法中指向父类的原型
        // 在静态方法中指向父类本身
        class Parent {
            constructor() {
                this.address = "江苏"
            }
            print() {
                return this.address
            }
        }
        Parent.getName = () => {
            return "zks"
        }
        class Childs extends Parent {
            constructor() {
                super();
            };
            print() {
                console.log(super.print());
                // console.log(super.getName()); //报错指向父类的原型对象
            }
            static coount() {
                console.log(super.getName()); //指向父类本身
            }
        }
        const ch = new Childs();
        ch.print();
        Childs.coount()
    </script>
</body>

</html>